import { Modal, message } from 'ant-design-vue'

// 全局消息提示和确认对话框工具
export const AnyMessageBox = {
  message: {
    success: (content: string) => {
      message.success(content)
    },
    error: (content: string) => {
      message.error(content)
    },
    info: (content: string) => {
      message.info(content)
    },
    warning: (content: string) => {
      message.warning(content)
    }
  },

  // 危险确认框
  confirmDanger: (title: string, content: string, onOk: () => void, onCancel?: () => void) => {
    Modal.confirm({
      title,
      content,
      okText: '确认',
      cancelText: '取消',
      okType: 'danger',
      onOk,
      onCancel
    })
  },

  // 普通确认框
  confirm: (title: string, content: string, onOk: () => void, onCancel?: () => void) => {
    Modal.confirm({
      title,
      content,
      okText: '确认',
      cancelText: '取消',
      onOk,
      onCancel
    })
  }
}

// 默认导出，方便使用
export default AnyMessageBox